<extend name="Index:base" />
<block name="title"><title>广告管理</title></block>
<block name="style">
 <style>
.main,.panel-default>.panel-heading{
background:none;
}
body{
background:none;
}
.panel.panel-default,.panel .panel-body,.panel .panel-heading,.table-bordered {
	border:none;
}
.table-bordered > thead > tr > th, .table-bordered > tbody > tr > th, .table-bordered > tfoot > tr > th, .table-bordered > thead > tr > td, .table-bordered > tbody > tr > td, .table-bordered > tfoot > tr > td {
	border:none;		
	padding:15px;	
	line-height:8px;
	height: 8px;
	border-top: 1px solid #d4d4d4;
	border-bottom: 1px solid #d4d4d4;
}
.name strong{
color:#000000;
font-size:15px;
font-weight:600;
}
.name {
	color:#20a8d8;
	font-size:12px;
}
.smallfont {
	color:#9c9c9c;
	font-size:12px;
}

.align-center{
	text-align:center; 
}
.title2{
text-align:center;
}
.table-bordered > tbody > tr .wd{
	text-align:left;	
}

.col-xs-2,.col-xs-4{
padding-right:0;
margin:10px 0;
}
.col-sm-3{
width:10%;
}
.col-sm-2{
width:8%;
}
.col-sm-1{
width:5%;
}
.col-sm-4{
width:18%;
}
.col-sm-1,.col-sm-2{
margin:16px 0;
}
.col-sm-3,.col-sm-4{
margin:10px 0;
}
.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4{
padding-right:0;
}
 </style>
</block>
	<!-- start: Header -->
<block name="body">

			<!-- end: Main Menu -->
						
		<!-- start: Content -->
		<div class="main ">
		
			<div class="row">
				<div class="col-lg-12">
					<h3 class="page-header"><i class="fa fa-life-bouy"></i>广告管理</h3>
				</div>
			</div>

			<div class="row">		
				<div class="col-lg-12">
					<div class="panel panel-default">
					
					
						<div class="panel-heading">
							<h2><span class="break"></span><strong>广告管理</strong></h2>
							&nbsp;&nbsp;&nbsp;
							<a class="btn btn-default " href="{:U('Index/home_ad')}?type=h_adv_add" id="adv_add">新增广告位</i></a>
						</div>
						
						<ol class="breadcrumb" style="height:55px;background-color: #ffffff;">							
							<li><i class="fa fa-warning"></i><a href="#">操作提示：</a></li><br/>	
							<li><font style="font-size:8px;color:#888;">将广告位调用代码放入前台页面，将显示该广告位的广告</font></li>							
						</ol>
						<div class="panel-body">
							<table class="table table-striped table-bordered bootstrap-datatable datatable">
							  <thead>
								  <tr>
								  
									  <th>名称</th>
									  <th>&nbsp;</th>
									  <th class="title2">广告位</th>
									  <th class="title2">宽度/字数</th>
									  <th class="title2">正在展示</th>
									  <th class="title2">是否启用</th>
									  <th class="title2">操作</th>
								  </tr>
							  </thead>   
							  <tbody id="state">
								<foreach name="list" item="vo">
								<tr>
									<td>{$vo.adv_title}</td>
									<td class="wd">
									<img src="{$vo.adv_pic}" onload="javascript:DrawImage(this,56,56);" width="210" height="50">
									</td>
									<td class="align-center">
																													<if condition="$vo.ap_id eq '0'">
												首页-顶部
									<elseif condition="$vo.ap_id eq '1'"/>					
												首页-中部
									<elseif condition="$vo.ap_id eq '2'"/>首页-底部	
									</if>
									</td>
									 <td class="align-center">
										宽:1200px;高:90px 
									 </td>
									
									<td class="align-center">
									<if condition="$vo.adv_states eq '1'">是</if>
									<if condition="$vo.adv_states eq '2'">否</if>
									</td>
									<td class="align-center">
									<if condition="$vo.adv_states eq '1'">是</if>
									<if condition="$vo.adv_states eq '2'">否</if>
									</td>
									<td class="align-center">
										<a class="label label-primary"  href="{:U('Index/home_ad')}?type=h_adv_edit&adv_id={$vo.adv_id}" >编辑</i>
										</a>							
										</a>
									 </td>

								</tr>
								</foreach>
							  </tbody>
						  </table>  
							<ul class="pagination">
								{$page}
							 </ul>						  
						</div>
					</div>
				</div><!--/col-->
			
			</div><!--/row-->				
			
		<!-- end: Content -->
		<br><br><br>
		
	</div><!--/container-->
	
</block>
<block name="script">
<script>

$(".align-center a").click(function(){

    var id = $(this).attr('data-id');
	var state = $(this).find('span').attr('data-status');
	
	var type = $(this).attr('data-type');
	//alert(id);	
	if (id && state && type=="edit") {
		if(confirm("确定要操作吗？")){
			//是
			$.ajax({
				url:"{:U('Goods/stata_edit')}",
				data:{id:id,state:state,str:'id',table:1},
				type:'post',
				dataType:'json',
				success:function (e) {			
				
					alert(e.info);
					location.reload();				
				}
			});													
		}else{
			//否
			return false;
		}		
	}  

});
</script>
</block>	









